import pandas
# pip install pandas

csvfile = 'E:\\dataset\\ratings.csv'

data = pandas.read_csv(csvfile, nrows=1)
print(data.columns)

# usecols = ['userId', 'restId', 'rating', 'rating_env', 'rating_flavor', 'rating_service', 'timestamp', 'comment']
usecols = ['userId', 'restId', 'rating']
# 打开文件并加载前15行数据
data = pandas.read_csv(csvfile, nrows=15, usecols=usecols)
print(data)
print(data.value_counts())
data.value_counts()
data.sort_values().plot(kind='barh')
# print(data.head())
# 过滤前5行数据
# head5Datas = data.head(5)
# print(head5Datas)
# print(head5Datas.ix[:, ])
# print(head5Datas.rating_env)
# print(head5Datas.comment)

